import { fetch } from '@/common/request'

// 设置为体验者，免费使用语音讲解
export const setUserFree = (param, options) => fetch({ url: '/user/setfree', param, options })

/**
 * 用户类
 */

// 微信登录
export const snsLogin = (param, options) => fetch({ url: '/user/snsLogin', param, options })

// 获取各种跳转地址
export const getAuthUrl = (param, options) => fetch({ url: '/user/getAuthUrl', param, options })
//
// // 获取openid
// export const getWXopenId = (post) => fetch('/user/getWXopenId', emptyObject(post), 'POST');
//
// // 获取用户信息
// export const getUser = (post) => fetch('/user', emptyObject(post), 'POST');
//
// // 修改昵称
// export const changeNickname = (post) => fetch('/user/changeNickname', emptyObject(post), 'POST');
//
// // 修改头像
// export const changeHeadimg = (post) => fetch('/user/changeHeadimg', emptyObject(post), 'POST');
//
// // 注册
// export const register = (post) => fetch('/user/register', emptyObject(post), 'POST');
//
// // 登录
export const login = (param, options) => fetch({ url: '/user/login', param, options })

//
// // 退出登录
export const logout = (param, options) => fetch({ url: '/user/logout', param, options })
//
// // 绑定手机
// export const bindPhone = (post) => fetch('/user/bindPhone', emptyObject(post), 'POST');
//
// // 重置密码
// export const forget = (post) => fetch('/user/forget', emptyObject(post), 'POST');
//
// 手机号登录
export const smsLogin = (param, options) => fetch({ url: '/user/smsLogin', param, options })

/**
 * 工具类
 */

// 发送短信
export const sendSms = (param, options) => fetch({ url: '/tool/sendSms', param, options })

export const register = (param, options) => fetch({ url: '/user/register', param, options })

export const forgotpwd = (param, options) => fetch({ url: '/user/forgotpwd', param, options })

export const changePassword = (param, options) => fetch({ url: '/user/changePassword', param, options })

export const changePhone = (param, options) => fetch({ url: '/user/changePhone', param, options })

export const changeNickname = (param, options) => fetch({ url: '/user/changeNickname', param, options })

export const changeHeadimg = (param, options) => fetch({ url: '/user/changeHeadimg', param, options })

export const userUniLogin = (param, options) => fetch({ url: '/user/unilogin', param, options })
//
// export const purchaser = (post) => fetch('/order/purchaser', emptyObject(post), 'POST');
//
export const favorite = (param, options) => fetch({ url: '/favorite', param, options })

/**
 * 获取收货地址
 */

// 收货地址
export const address = (param, options) => fetch({ url: '/address', param, options })

// 获取用户信息
export const getUserInfo = (param, options) => fetch({ url: '/user/info', param, options })

// 保存收货地址
export const saveAddress = (param, options) => fetch({ url: '/address/save', param, options })

// 删除收货地址
export const delAddress = (param, options) => fetch({ url: '/address/del', param, options })


//
// export const search = (post) => fetch('/search', emptyObject(post), 'POST');

/**
 * 订单类
 */
export const order = (param, options) => fetch({ url: '/order', param, options })

export const unifyOrder = (param, options) => fetch({ url: '/order/unifyorder', param, options })
// // requie order_sn
export const getOrderBaseInfo = (param, options) => fetch({ url: '/order/easy', param, options })

//
export const unifyPay = (param, options) => fetch({ url: '/order/unifypay', param, options })

export const cancelOrder = (param, options) => fetch({ url: '/order/cancelOrder', param, options })

export const confirmOrderGet = (param, options) => fetch({ url: '/order/confirmGet', param, options })
// 再次支付
export const aginPay = (param, options) => fetch({ url: '/order/againpay', param, options })
